/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.jomijushi.fid.dominio;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author miguel
 */
@Entity
@Table(name = "fid_pedido_genera_comprobante_venta", catalog = "fid", schema = "")
@NamedQueries({@NamedQuery(name = "FidPedidoGeneraComprobanteVenta.findAll", query = "SELECT f FROM FidPedidoGeneraComprobanteVenta f"), @NamedQuery(name = "FidPedidoGeneraComprobanteVenta.findByFidPedidoVentaId", query = "SELECT f FROM FidPedidoGeneraComprobanteVenta f WHERE f.fidPedidoGeneraComprobanteVentaPK.fidPedidoVentaId = :fidPedidoVentaId"), @NamedQuery(name = "FidPedidoGeneraComprobanteVenta.findByFidComprobanteVentaId", query = "SELECT f FROM FidPedidoGeneraComprobanteVenta f WHERE f.fidPedidoGeneraComprobanteVentaPK.fidComprobanteVentaId = :fidComprobanteVentaId"), @NamedQuery(name = "FidPedidoGeneraComprobanteVenta.findByFecha", query = "SELECT f FROM FidPedidoGeneraComprobanteVenta f WHERE f.fecha = :fecha"), @NamedQuery(name = "FidPedidoGeneraComprobanteVenta.findByCreatedAt", query = "SELECT f FROM FidPedidoGeneraComprobanteVenta f WHERE f.createdAt = :createdAt"), @NamedQuery(name = "FidPedidoGeneraComprobanteVenta.findByUpdatedAt", query = "SELECT f FROM FidPedidoGeneraComprobanteVenta f WHERE f.updatedAt = :updatedAt")})
public class FidPedidoGeneraComprobanteVenta implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected FidPedidoGeneraComprobanteVentaPK fidPedidoGeneraComprobanteVentaPK;
    @Column(name = "fecha")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecha;
    @Column(name = "created_at")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createdAt;
    @Column(name = "updated_at")
    @Temporal(TemporalType.TIMESTAMP)
    private Date updatedAt;
    @JoinColumn(name = "fid_pedido_venta_id", referencedColumnName = "id", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private FidPedidoVenta fidPedidoVenta;
    @JoinColumn(name = "fid_comprobante_venta_id", referencedColumnName = "id", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private FidComprobanteVenta fidComprobanteVenta;

    public FidPedidoGeneraComprobanteVenta() {
    }

    public FidPedidoGeneraComprobanteVenta(FidPedidoGeneraComprobanteVentaPK fidPedidoGeneraComprobanteVentaPK) {
        this.fidPedidoGeneraComprobanteVentaPK = fidPedidoGeneraComprobanteVentaPK;
    }

    public FidPedidoGeneraComprobanteVenta(int fidPedidoVentaId, int fidComprobanteVentaId) {
        this.fidPedidoGeneraComprobanteVentaPK = new FidPedidoGeneraComprobanteVentaPK(fidPedidoVentaId, fidComprobanteVentaId);
    }

    public FidPedidoGeneraComprobanteVentaPK getFidPedidoGeneraComprobanteVentaPK() {
        return fidPedidoGeneraComprobanteVentaPK;
    }

    public void setFidPedidoGeneraComprobanteVentaPK(FidPedidoGeneraComprobanteVentaPK fidPedidoGeneraComprobanteVentaPK) {
        this.fidPedidoGeneraComprobanteVentaPK = fidPedidoGeneraComprobanteVentaPK;
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    public Date getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }

    public Date getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(Date updatedAt) {
        this.updatedAt = updatedAt;
    }

    public FidPedidoVenta getFidPedidoVenta() {
        return fidPedidoVenta;
    }

    public void setFidPedidoVenta(FidPedidoVenta fidPedidoVenta) {
        this.fidPedidoVenta = fidPedidoVenta;
    }

    public FidComprobanteVenta getFidComprobanteVenta() {
        return fidComprobanteVenta;
    }

    public void setFidComprobanteVenta(FidComprobanteVenta fidComprobanteVenta) {
        this.fidComprobanteVenta = fidComprobanteVenta;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (fidPedidoGeneraComprobanteVentaPK != null ? fidPedidoGeneraComprobanteVentaPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof FidPedidoGeneraComprobanteVenta)) {
            return false;
        }
        FidPedidoGeneraComprobanteVenta other = (FidPedidoGeneraComprobanteVenta) object;
        if ((this.fidPedidoGeneraComprobanteVentaPK == null && other.fidPedidoGeneraComprobanteVentaPK != null) || (this.fidPedidoGeneraComprobanteVentaPK != null && !this.fidPedidoGeneraComprobanteVentaPK.equals(other.fidPedidoGeneraComprobanteVentaPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.jomijushi.fid.dominio.FidPedidoGeneraComprobanteVenta[fidPedidoGeneraComprobanteVentaPK=" + fidPedidoGeneraComprobanteVentaPK + "]";
    }

}
